package com.haowang.camera.manager;


import android.annotation.SuppressLint;
import android.graphics.SurfaceTexture;
import android.graphics.SurfaceTexture.OnFrameAvailableListener;
import android.util.Log;

import com.haowang.camera.activity.CameraActivity;
import com.haowang.camera.util.ApiHelper;

@SuppressLint("NewApi")
public class SurfaceTexturePreviewManager extends PreviewManager implements
		OnFrameAvailableListener {

	private static final String TAG = SurfaceTexturePreviewManager.class.getSimpleName();
	private SurfaceTexture mSurfaceTexture;
	int[] textures = new int[1];

	public SurfaceTexturePreviewManager(CameraActivity context) {
		super(context);
		mActivity = context;
	}

//	@Override
//	protected void init() {
//		try {
//			initGL();
//			mSurfaceTexture = new SurfaceTexture(textures[0]);
//
//			if (ApiHelper.HasSurfaceTexture()) {
//				mActivity.getCameraModule().getCameraDevice()
//						.setDisplayOrientation(0);/* TODO */
//				mActivity.getCameraModule().getCameraDevice()
//						.setPreviewTexture(mSurfaceTexture);
//			}
//			mSurfaceTexture.setOnFrameAvailableListener(this);
//		} catch (Exception e) {
//			Log.e(TAG, "init failed");
//		}
//		super.init();
//	}

	private void initGL() {

	}

	@Override
	protected void reset() {
		mSurfaceTexture.release();
		super.reset();
	}

	public SurfaceTexture getSurfaceTexture() {

		return mSurfaceTexture;
	}

	@Override
	public void onFrameAvailable(SurfaceTexture arg0) {
		// TODO Auto-generated method stub
		
	}

}
